package xml.jsoup;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;

import java.io.File;
import java.io.IOException;

public class JsoupDemo1 {
    public static void main(String[] args) throws IOException {
        //获取Doc对象
        //（1）获取student.xml的path
        String path = JsoupDemo1.class.getClassLoader().getResource("C:\\ImportantSoftForCode\\IdeaProjects\\JavaWeb\\xml\\student.xml").getPath();
        //(2)解析student.xml的path,加载文档进内存，获取dom树-->Document
        Document document = Jsoup.parse(new File(path), "utf-8");
        //(3)获取元素对象Element
      Elements elements = document.getElementsByTag("name");
        System.out.println(elements.size());
    }
}
